package com.cu.jiekong.frame;

import com.cu.jiekong.constants.ResultStatus;
import com.cu.jiekong.frame.model.Ret;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author jintian
 * @date 14:55
 */
public class HystrixHandler implements FallbackFactory {

    private Logger logger = LoggerFactory.getLogger(HystrixHandler.class);

    public Ret create(Throwable throwable) {
        logger.info("fallback; reason was: {}", throwable.getMessage());
        return new Ret(ResultStatus.RESULT_400002.getCode(), ResultStatus.RESULT_400002.getMsg());
    }
}
